package indi.jp.project.core.controller;

import indi.jp.project.core.entity.JsonResult;
import indi.jp.project.core.entity.User;
import indi.jp.project.core.service.LoginService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/")
public class LoginController {

    private LoginService loginService;

    public LoginController(LoginService loginService) {
        this.loginService = loginService;
    }

    @PostMapping("/login")
    @ResponseBody
    public JsonResult login(@RequestBody User user){
        JsonResult res;
        res = loginService.validateUser(user);
        return res;
    }

}
